package com.example.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.entity.SysUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.Map;

@Mapper
@Repository
public interface UserMapper extends BaseMapper<SysUser> {
    // 一对多查询
//    Page<User> findPage(Page<User> page, @Param("peopleName") String peopleName);


//    @Select("select count(id) count, address from user GROUP BY address")
//    List<UserAddressDto> countAddress();

    // 查询用户名
    @Select("select password from t_user where username=#{username}")
    SysUser selectByName(String username);

    @Update("update t_user set password = #{newPass} where id = #{userId}")
    int updatePass(Map<String, Object> map);
}
